package com.hangzhou.xyj.net.request.base;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by neo.duan on 2015/12/20.
 * 各个请求基类
 */
public abstract class BaseRequest {
    private static final String TAG = BaseRequest.class.getSimpleName();
    protected Map<String, Object> params = new HashMap<String, Object>();

    public abstract String getUrl();

    public void add(String param, Object paramValue) {
        params.put(param, paramValue);
    }

    public Map<String, Object> getParams() {
        return this.params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }

    private String getApiPath() {
        return getUrl().replaceFirst("/", "");
    }

    public int valueOf(String value) {
        try {
            return Integer.valueOf(value);
        } catch (Exception e) {
            return -1;
        }
    }
}
